package C616;

/**
 * @program: javase
 * @description: this不能递归调用，编译报错
 * @author: luolidong
 * @create: 2021-06-16 14:44
 * @version: 1.0
 */
public class TestThis {
    {
        this.id=22;
//        TestThis testThis = new TestThis();//StackOverFlow
        System.out.println("初始化块");
    }
    int id;
    String name;
//    初始化块受到位置的影响
    public TestThis(int id, String name) {
//        this(id);
        this();
        System.out.println("TestThis(int id, String name) 构造器");
        this.id = id;
        this.name = name;
    }

    public TestThis() {
        System.out.println("无参构造器");
    }

//    public TestThis(int id) {
//        this(1,"ee");
//        this.id = id;
//    }

    @Override
    public String toString() {
        return "TestThis{" +
                "id=" + id +
                ", name='" + name + '\'' +
                '}';
    }

    public static void main(String[] args) {
        TestThis testThis = new TestThis(11,"12");
        System.out.println(testThis);
        TestThis testThis1 = new TestThis();
        System.out.println(testThis1);

//        Boolean aBoolean = new Boolean(true);
//        boolean b = aBoolean.booleanValue();

    }

}
